
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Probability.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Probability)
{
    TEST(should be able to judge the probability1 is equal to probability2: probability1 = 0.1, probability2 = 0.1)
	{
		Probability probability1(0.1);
        Probability probability2(0.1);
		ASSERT_EQ(true, probability1 == probability2);
	}
	
	TEST(should be able to judge the probability1 is not equal to probability2: probability1 = 0.1, probability2 = 0.2)
	{
		Probability probability1(0.1);
        Probability probability2(0.2);
		ASSERT_EQ(true, probability1 != probability2);
	}
	
	TEST(should be able to calc the reverse of the probability1: probability1 = 0.1, probability2 = 0.9)
	{
		Probability probability1(0.1);
        Probability probability2(0.9);
		ASSERT_EQ(probability2, ~probability1);
	}

	TEST(should be able to calc the probability of both the probability1 and probability2 happen: probability1 = 0.7, probability2 = 0.8, probability3 = 0.56)
	{
		Probability probability1(0.7);
        Probability probability2(0.8);
        Probability probability3(0.56);
		ASSERT_EQ(probability3, (probability1 & probability2));
	}

	TEST(should be able to calc the probability of either the probability1 or probability2 happen: probability1 = 0.7, probability2 = 0.8, probability3 = 0.94)
	{
		Probability probability1(0.7);
        Probability probability2(0.8);
        Probability probability3(0.94);
		ASSERT_EQ(probability3, (probability1 | probability2));
	}
};
